const userInfoList =　{
    admin:{
        role:'admin',
        userNum:"admin",
        password:'admin',
        userName:"张三"
    },
    user:{
        role:'user',
        userNum:"user",
        password:'user',
        userName:"克里斯"
    },
    superadmin:{
        role:'superadmin',
        userNum:"superadmin",
        password:'superadmin',
        userName:"杰克"
    }
}
const userNumList = ["admin","user","superadmin"];
const loginList = [];
export default function request(url,params){
    const data = new loginClass();
    switch (url){
        case '/login':
            return data.login(params);
        case '/logout':
            break;
    }
}

class loginClass{
    login(params){
        if(userNumList.includes(params.userName)){
            if(params.password === userInfoList[params.userName].password){
                const returnData = {
                    role:userInfoList[params.userName].role,
                    userNum:userInfoList[params.userName].userNum,
                    userName:userInfoList[params.userName].userName,
                }
                return {massage:"成功",status:0,data:{...returnData}}
            }else{
                return {massage:'密码错误',status:102}
            }
        }else{
            return {massage:"用户不存在",status:101}
        }
    }
}